(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/endmoneyArea.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '100c5lYcRBArYxMBT9fC4WH', 'endmoneyArea', __filename);
// Script/endmoneyArea.js

"use strict";

cc.Class({
    extends: cc.Component,

    properties: {

        sprArray: {
            default: [],
            type: [cc.SpriteFrame]
        },
        firstdigit: cc.Node,
        seconddigit: cc.Node,
        threedigit: cc.Node

    },

    onLoad: function onLoad() {},
    init: function init(coinNumber) {

        var number = coinNumber;
        console.log("红包数", coinNumber);
        number = number.toString(); //把数字转换成字符串
        if (number.length == 1) {

            number = "00" + number;
        } else if (number.length == 2) {
            number = "0" + number;
        } else {

            console.log("刚好三位不做处理");
        }
        for (var i = 0; i < number.length; i++) {

            if (i == 0) {
                this.firstdigit.getComponent(cc.Sprite).spriteFrame = this.sprArray[number[0]];
                this.firstdigit.getComponent(cc.Sprite).sizeMode = cc.Sprite.SizeMode.CUSTOM;
                this.firstdigit.getComponent(cc.Sprite).type = cc.Sprite.Type.SIMPLE;
                var rect = this.sprArray[number[0]].getRect(); //获取节点的轮扩
                console.log("个位数图片宽度", rect.width);
                this.firstdigit.width = rect.width;
                if (number[0] == 0) {
                    this.firstdigit.width = this.firstdigit.width - 4;
                }
            } else if (i == 1) {
                this.seconddigit.getComponent(cc.Sprite).spriteFrame = this.sprArray[number[1]];
                this.seconddigit.getComponent(cc.Sprite).sizeMode = cc.Sprite.SizeMode.CUSTOM;
                this.seconddigit.getComponent(cc.Sprite).type = cc.Sprite.Type.SIMPLE;
                var _rect = this.sprArray[number[1]].getRect(); //获取节点的轮扩
                console.log("小数第一位图片宽度", _rect.width);
                this.seconddigit.width = _rect.width;
                if (number[1] == 0) {
                    this.seconddigit.width = this.seconddigit.width - 4;
                }
            } else {
                this.threedigit.getComponent(cc.Sprite).spriteFrame = this.sprArray[number[2]];
                this.threedigit.getComponent(cc.Sprite).sizeMode = cc.Sprite.SizeMode.CUSTOM;
                this.threedigit.getComponent(cc.Sprite).type = cc.Sprite.Type.SIMPLE;
                var _rect2 = this.sprArray[number[2]].getRect(); //获取节点的轮扩
                console.log("小数第2位图片宽度", _rect2.width);
                this.threedigit.width = _rect2.width;
                if (number[2] == 0) {
                    this.threedigit.width = this.threedigit.width - 4;
                }
            }
        }
    },
    start: function start() {}
}

// update (dt) {},
);

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=endmoneyArea.js.map
        